package com.fivestar.pmanager.web.business.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fivestar.pmanager.core.base.BaseCommonParameterBean;
import com.fivestar.pmanager.core.exception.DMLNoRecordEffectedException;
import com.fivestar.pmanager.model.FsUserBean;
import com.fivestar.pmanager.service.FsUserService;

/**
 * 注册用户业务服务
 * Created by admin
 */
@Service("registeredUserBusiService")
public class FsUserBusiService
{

    @Autowired
    private FsUserService fsUserService;


    /**
     * 更新用户状态
     *
     * @param rowId 主键
     * @param status 状态
     * @param commonParameterBean 操作人
     * @throws DMLNoRecordEffectedException
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateUserStatus(int rowId, String status, BaseCommonParameterBean commonParameterBean)
            throws DMLNoRecordEffectedException
    {
        FsUserBean newUser = new FsUserBean();
        newUser.setRowId(rowId);
        newUser.setStatus(status);
        fsUserService.updateBySelective(newUser, commonParameterBean);
    }


    /**
     * 新增用户
     *
     */
    @Transactional(rollbackFor = Exception.class)
    public void addUser(FsUserBean fsUser ,BaseCommonParameterBean commonParam) throws Exception {
    	fsUserService.insert(fsUser, commonParam);
    }
    
    /**
     * 更新用户状态
     *
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateUserStatus(FsUserBean fsUser ,BaseCommonParameterBean commonParam) throws Exception {
    	fsUserService.updateBySelective(fsUser, commonParam);
    }
    
}
